const cloud = require('wx-server-sdk')
// 默认配置
cloud.init()
const db = cloud.database();
const category = db.collection('category');

// exports.main = async (event, context) => category.where({
//   belong: event.id
// }).get()


exports.main = async (event, context) => {
  //取得传过来的参数, 可以使用{vote,id } = event 更简洁
  //var vote = event.vote, id = event.id;
  //console.log('云函数zan成功', vote, id)

  // console.warn(data)

  try {
    return await category.where({
      belong: event.id
    }).get()
  } catch (err) {
    console.log(err);
  }

}
